import { http_common } from '@/api'

const state = {
  dict: {

  },
  enum: {

  }
}

const mutations = {
  SET_DICT(state, val) {
    state.dict = val
  },
  SET_ENUM(state, val) {
    state.enum = val
  }
}
const actions = {
  getEnum({ commit }, codes) {
    return new Promise((resolve, reject) => {
      http_common.enum(codes).then(res => {
        commit('SET_ENUM', res)
      }).finally(() => {
        resolve()
      })
    })
  },
  getDict({ commit }, codes) {
    return new Promise((resolve, reject) => {
      http_common.dict(codes).then(res => {
        commit('SET_DICT', res)
      }).finally(() => {
        resolve()
      })
    })
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
